package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.Need;
import com.wn55.hrms.entity.Trainer;
import com.wn55.hrms.mapper.NeedMapper;
import com.wn55.hrms.mapper.TrainerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zy
 * @date 2022/5/5 10:13
 */
@Service
public class NeedService {
    @Autowired
    NeedMapper needMapper;

    public PageInfo<Need> needList(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<Need> list = needMapper.selectByName(name);
        return new PageInfo<>(list);

    }

    public void modify(Need need) {
        needMapper.update(need);
    }

    public void add(Need need) {
        needMapper.insert(need);
    }

    public void removeBykey(int id) {
        needMapper.deleteByPrimaryKey(id);
    }
}
